package game;

import java.util.Random;

class SceneManager
{
    static private SCENE currentScene;
    static public Scene scene = null;

    static Random rand = new Random();

	static public void setup()
	{
		LoadImage.GetInstance().InitList();
		SceneManager.scene = new Opening();
		SceneManager.currentScene = SCENE.SCN_OPENING;
	}

	static public void changeScene(int number)
	{
		switch (SceneManager.currentScene)
		{
			case SCN_OPENING:
				Audios.getInstance().Loop(5);
				SceneManager.scene = new Menu();
				SceneManager.currentScene = SCENE.SCN_MENU;
				break;
			case SCN_MENU:
				switch(number)
				{
					case 0:
						Audios.getInstance().stopAll();
						SceneManager.scene = new Level_01();
						SceneManager.currentScene = SCENE.SCN_LEVEL_01;
						break;
					case 1:
						SceneManager.scene = new Instruction();
						SceneManager.currentScene = SCENE.SCN_INSTRUCTION;
						break;
					case 2:
						SceneManager.scene = new Credits();
						SceneManager.currentScene = SCENE.SCN_CREDITS;
						break;
				}
				break;
			case SCN_INSTRUCTION:
				SceneManager.scene = new Menu();
				SceneManager.currentScene = SCENE.SCN_MENU;
				break;
			case SCN_CREDITS:
				SceneManager.scene = new Menu();
				SceneManager.currentScene = SCENE.SCN_MENU;
				break;
			case SCN_LEVEL_01:
				Audios.getInstance().stopAll();
				SceneManager.currentScene = SCENE.SCN_GAMEOVER;
				SceneManager.changeScene(0);
				break;
			case SCN_GAMEOVER:
				Audios.getInstance().Loop(5);
				SceneManager.scene = new Menu();
				SceneManager.currentScene = SCENE.SCN_MENU;
				break;

			default:
				break;
		}
	}



	enum SCENE
	{
		SCN_OPENING,
		SCN_MENU,
		SCN_INSTRUCTION,
		SCN_CREDITS,
		SCN_CONGRATS,
		SCN_GAMEOVER,
		SCN_LEVEL_01,
	}
}
